package com.zwc.common

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.viewbinding.ViewBinding

/**
 * author:zuoweichen
 * DAte:2023-12-06 16:55
 * Description:描述
 */
abstract class BaseFragment<V : ViewBinding> : Fragment() {
    protected lateinit var binding: V
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
    ): View? {
        binding = createViewBinding(inflater)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initView()
        initData()
    }

    abstract fun createViewBinding(layoutInflater: LayoutInflater): V
    abstract fun initView()

    abstract fun initData()
}